﻿@model User_addr_book
@{
    Layout = null;
    Sysconfig config = ViewData["config"] as Sysconfig;
    string action = ViewBag.action as string;
}
<!DOCTYPE html>
<!--HTML5 doctype-->
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=0">
    <title>收货地址</title>
    <link rel="stylesheet" type="text/css" href="/mobile/css/style.css" />
    <link rel="stylesheet" type="text/css" href="/mobile/css/validate.css" />
    <script type="text/javascript" charset="utf-8" src="/mobile/js/zepto.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/weui.min.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/common.js"></script>
    <script type="text/javascript" charset="utf-8" src="/scripts/jquery/PCASClass.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate.js"></script>
    <script type="text/javascript" charset="utf-8" src="/mobile/js/mvalidate-extend.js"></script>
    <script type="text/javascript">
        $(function () {
            //初始化表单
            AjaxInitForm('#editForm', '#btnSubmit', 1, '#turl');
        });
    </script>
</head>

<body ontouchstart>
    <div class="page">
        <!--页面头部-->
        <div class="header">
            <a class="back" href="javascript:history.back();">
                <i class="iconfont icon-arrow-left"></i>
            </a>
            <h3>编辑地址簿</h3>
            <div class="right">
                <a class="weui-cell_access weui-cell_link" asp-area="Web" asp-controller="Usercenter" asp-action="Index" asp-route-act="index">
                    <i class="iconfont icon-user"></i>
                </a>
            </div>
        </div>
        <!--/页面头部-->
        <!--页面内容-->
        <div class="page__bd">
            @if(action=="edit")
            {
            <!--编辑地址-->
            <script type="text/javascript">
                $(function () {
                    //初始化地区
                    var mypcas = new PCAS("txtProvince,所属省份", "txtCity,所属城市", "txtArea,所属地区");
                    var areaArr = ("@Model.area").split(",");
                    if (areaArr.length == 3) {
                        mypcas.SetValue(areaArr[0], areaArr[1], areaArr[2]);
                    }
                });
            </script>
            <form id="editForm" name="editForm" class="form-box" url="/submit_ajax?action=user_address_edit&id=@Model.id">
                <div class="weui-panel weui-panel_access" style="margin-top:10px;">
                    <div class="weui-panel__hd">编辑地址</div>
                    <div class="weui-panel__bd">
                        <div class="weui-cells_form form-box">
                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">收件人</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtAcceptName" name="txtAcceptName" class="weui-input" type="text" value="@Model.accept_name" placeholder="收件人名称" data-validate="s" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">所属地区</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <select id="txtProvince" name="txtProvince" class="select"></select>
                                    <select id="txtCity" name="txtCity" class="select"></select>
                                    <select id="txtArea" name="txtArea" class="select" data-validate="select"></select>
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">详细地址</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtAddress" name="txtAddress" class="weui-input" type="text" value="@Model.address" placeholder="详细地址" data-validate="s" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">手机号</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtMobile" name="txtMobile" class="weui-input" type="tel" value="@Model.mobile" placeholder="请输入手机号" data-validate="m" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">电话</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtTelphone" name="txtTelphone" class="weui-input" type="text" value="@Model.telphone" placeholder="电话号码，非必填" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">邮箱</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtEmail" name="txtEmail" class="weui-input" type="text" value="@Model.email" placeholder="方便通知，非必填" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">邮政编码</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtPostCode" name="txtPostCode" class="weui-input" type="text" value="@Model.post_code" placeholder="邮政编码，非必填" />
                                </div>
                            </div>
                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">验证码</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtCode" name="txtCode" class="weui-input" type="text" placeholder="请输入验证码" data-validate="code" />
                                </div>
                                <div class="weui-cell__ft">
                                    <a href="javascript:;" onclick="ToggleCode(this, '/verify_code/index');return false;">
                                        <img class="weui-vcode-img" src="/verify_code/index" style="width:82px;height:24px;" />
                                    </a>
                                </div>
                            </div>
                        </div>

                    </div>
                </div>

                <div class="weui-btn-area">
                    <input id="btnSubmit" name="btnSubmit" type="submit" class="weui-btn weui-btn_primary" value="确认提交" />
                </div>
            </form>
            <!--/编辑地址-->
            }
            else
            {
            <!--新增地址-->
            <script type="text/javascript">
                $(function () {
                    //初始化地区
                    var mypcas = new PCAS("txtProvince,所属省份", "txtCity,所属城市", "txtArea,所属地区");
                });
            </script>
            <form id="editForm" name="editForm" class="form-box" url="/submit_ajax?action=user_address_edit">
                <div class="weui-panel weui-panel_access" style="margin-top:10px;">
                    <div class="weui-panel__hd">新增地址</div>
                    <div class="weui-panel__bd">
                        <div class="weui-cells_form form-box">
                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">收件人</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtAcceptName" name="txtAcceptName" class="weui-input" type="text" placeholder="收件人名称" data-validate="s" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">所属地区</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <select id="txtProvince" name="txtProvince" class="select"></select>
                                    <select id="txtCity" name="txtCity" class="select"></select>
                                    <select id="txtArea" name="txtArea" class="select" data-validate="select"></select>
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">详细地址</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtAddress" name="txtAddress" class="weui-input" type="text" placeholder="详细地址" data-validate="s" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">手机号</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtMobile" name="txtMobile" class="weui-input" type="tel" placeholder="请输入手机号" data-validate="m" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">电话</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtTelphone" name="txtTelphone" class="weui-input" type="text" placeholder="电话号码，非必填" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">邮箱</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtEmail" name="txtEmail" class="weui-input" type="text" placeholder="方便通知，非必填" />
                                </div>
                            </div>

                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">邮政编码</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtPostCode" name="txtPostCode" class="weui-input" type="text" placeholder="邮政编码，非必填" />
                                </div>
                            </div>
                            <div class="weui-cell">
                                <div class="weui-cell__hd">
                                    <label class="weui-label">验证码</label>
                                </div>
                                <div class="weui-cell__bd">
                                    <input id="txtCode" name="txtCode" class="weui-input" type="text" placeholder="请输入验证码" data-validate="code" />
                                </div>
                                <div class="weui-cell__ft">
                                    <a href="javascript:;" onclick="ToggleCode(this, '/verify_code/index');return false;">
                                        <img class="weui-vcode-img" src="/verify_code/index" style="width:82px;height:24px;" />
                                    </a>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <div class="weui-btn-area">
                    <input id="btnSubmit" name="btnSubmit" type="submit" class="weui-btn weui-btn_primary" value="确认提交" />
                </div>
            </form>
            <!--/新增地址-->
            }

            <input id="turl" type="hidden" value="/Web/Useraddress/Index" /><!--存在跳转的URL值-->
            <!--版权信息-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Copyright.cshtml")
            <!--/版权信息-->
            <!--底部导航-->
            @await Html.PartialAsync("~/Areas/Web/Views/Shared/_Footer.cshtml")
            <!--/底部导航-->

        </div>
        <!--/页面内容-->

    </div>
</body>
</html>
